package com.example.administrator.yuejian2.model;

import com.example.administrator.yuejian2.RetrofitListener.RetrofitListener;
import com.example.administrator.yuejian2.bean.ClubBean;
import com.example.administrator.yuejian2.service.Club_DetailService;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

import static com.example.administrator.yuejian2.other.Url.BASEURL;
import static com.example.administrator.yuejian2.other.Url.URL1;

public class Club_DetailModel {

    private Retrofit retrofit;
    private Club_DetailService clubDetailService;

    public Club_DetailModel()
    {
        retrofit=new Retrofit.Builder()
                .baseUrl(BASEURL+URL1)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
        clubDetailService=retrofit.create(Club_DetailService.class);
    }
    public void clubDetail(String club_id,final RetrofitListener listener)
    {
        Call<ClubBean> call=clubDetailService.clubdetail(club_id);

        call.enqueue(new Callback<ClubBean>() {
            @Override
            public void onResponse(Call<ClubBean> call, Response<ClubBean> response) {
                listener.onSuccess(response.body(),1);
            }

            @Override
            public void onFailure(Call<ClubBean> call, Throwable t) {
                listener.onFail();
            }
        });
    }



}
